package com.ohuang.hilt.di

import android.util.Log
import com.ohuang.base.AuthInterceptorOkHttpClient
import com.ohuang.base.User
import dagger.Binds

import dagger.Module
import dagger.Provides
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.hilt.android.components.ActivityRetainedComponent
import dagger.hilt.android.scopes.ActivityRetainedScoped
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import javax.inject.Singleton

@Module
@InstallIn(ActivityRetainedComponent::class)
class NetworkModule {
    val TAG = "NetworkModule"

    @AuthInterceptorOkHttpClient
    @Provides
    fun provideAuthInterceptorOkHttpClient(
    ): OkHttpClient {
        Log.d(TAG, "provideAuthInterceptorOkHttpClient: ")
        return OkHttpClient.Builder()
            // Add an interceptor to log HTTP requests
            .addInterceptor(HttpLoggingInterceptor())
            // Build the client
            .build()
    }


    @Provides
    fun provideOtherInterceptorOkHttpClient(
    ): OkHttpClient {
        Log.d(TAG, "provideOtherInterceptorOkHttpClient: ")
        return OkHttpClient.Builder()
            .build()
    }

}